/*
* created by Administrator on 2018/12/3
* 好的代码像粥一样,是得用时间和精力熬的。
*/
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const userSchema = new Schema({
    uid:mongoose.Types.ObjectId,
    username: String,
    gender: Boolean,
    age:Number,
    city: String,
    password: String,
    phoneNumber: String,
});
const articleSchema = new Schema({
  aid: mongoose.Types.ObjectId,
  title: String,
  content: String,
  date: String,
  author: String,
  fav: Number
});
const translateSchema = new Schema({
    tid: mongoose.Types.ObjectId,
    username: Number,
    code: Number,
    content: String,
    english: String
});
//定义的方法 查询Fav 匹配字段
articleSchema.statics.findByFav = function (Number) {
     return this.find({fav: {$gte: Number,$lte: Number}})
};
module.exports = { userSchema, articleSchema, translateSchema };
